﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TextProject
{
	public partial class Form1 : Form
	{
		FormattedText text = new FormattedText();
		Style[] style = {	new Style("Impact", 22, FontStyle.Regular, new SColor(Color.Black), new SColor(Color.Brown)), 
							new Style("Courier", 10, FontStyle.Regular, new SColor(Color.Black), new SColor(Color.Yellow)),
							new Style("Tahoma", 12, FontStyle.Bold | FontStyle.Italic, new SColor(Color.Black), new SColor(Color.Red)),
							new Style("Courier", 15, FontStyle.Italic, new SColor(Color.Black), new SColor(Color.Green))
						};
		Random r = new Random();

		public Form1()
		{
			InitializeComponent();			
		}

		void Insert(char c)
		{
			text.Insert(c, style[/*r.Next(4)*/ 1]);
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			formattedTextBox1.Size = ClientSize;

            string s = System.Windows.Forms.Clipboard.GetText();
			s.Replace(Environment.NewLine, "\n");
			foreach (char c in s)
			{
				Insert(c);
			}
			formattedTextBox1.Text = text;
		}

		private void Form1_Resize(object sender, EventArgs e)
		{
			formattedTextBox1.Size = ClientSize;
			formattedTextBox1.Invalidate();
		}
	}
}
